<?php

namespace component\element\singleimage\controller;

use core\component\ElementBase;
use core\lib\upload\UploadImage;

class Index extends ElementBase
{
    public function index(...$param)
    {
        return $this->view($param);
    }

    public function upload()
    {
        $path = request()->elementinfo['plugin'] == '' ? 'frame'
            : request()->elementinfo['plugin'];



        $uploadImage = new UploadImage(
            path: $path,
        );
        $result = $uploadImage->upload();
        return $this->success($result);
    }
}
